home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / netutils / pmail311.arj / UDG.ZIP / UDG.TXT < prev   
Text File  |  1994-03-28  |  19KB  |  428 lines

  1. ┌────────────────────────────────────────────────────────────┐
  2. │                                                            │
  3. │    Pegasus Mail v3.0 user-defined gateway reference.       │
  4. │    This document is part of the Pegasus Mail manual set    │
  5. │    and is provided as a courtesy to users of Pegasus       │
  6. │    Mail.                                                   │
  7. │                                                            │
  8. │    Copyright 1992-93, David Harris, All Rights Reserved.   │
  9. │                                                            │
  10. └────────────────────────────────────────────────────────────┘
  11.  
  12.  
  13. User-defined gateways
  14. ---------------------
  15.  
  16. Pegasus Mail version 2.25 and later incorporate a feature which 
  17. allows you to implement your own mail transport and have PMail 
  18. use it. The intention is that you will provide the mechanism 
  19. for moving the messages and  attachments from place to place, 
  20. while PMail does the preparation, formatting and filing for you.
  21.  
  22. Here are some possible gateways you could develop:
  23.  
  24. *    An implementation of uucp for dial-in Internet mail
  25.  
  26. *    A standalone gateway which communicates with a machine attached 
  27. to your LAN, allowing you access to all your LAN mail features 
  28. from a remote machine (such a gateway is currently under development 
  29. as part of the PMail system).
  30.  
  31. *    A custom system which takes LAN mail and transfers it via some 
  32. file transfer protocol to a mainframe.
  33.  
  34. *    A gateway to a facsimile server.
  35.  
  36. The possibilities are limited only by your imagination.
  37.  
  38.  
  39. The gateway process.
  40. -------------------
  41.  
  42. While PMail offers considerable flexibility in the way it can 
  43. interact with your gateway, be aware that creating a gateway 
  44. will almost certainly involve a small amount of programming - 
  45. typically, you will need to write the program which PMail runs 
  46. to deliver and receive mail. You can do this programming in any 
  47. language which produces a program which could be run from DOS: 
  48. Pegasus Mail is written in C, but you could easily write your 
  49. gateway process in Pascal, Modula-II or even in Basic (God forbid!). 
  50. PMail invokes your gateway process when sending mail, or to check 
  51. for new mail. In most cases, your gateway process must not write 
  52. to the screen.
  53.  
  54. Note: you can use MS-DOS batch files as gateway processes.
  55.  
  56. What the gateway process does, and how you should do it is not 
  57. covered in this manual - this is your part of the project, and 
  58. you'll have to design it to your own specification. As a help, 
  59. however, the last section of this document describes how we interfaced 
  60. PMail with Waffle, a popular BBS and UUCP program.
  61.  
  62.  
  63. How PMail uses a UDG
  64. --------------------
  65.  
  66. You have to provide PMail with a set of instructions which it 
  67. uses to interface to your gateway. You do this using PMail's 
  68. PCONFIG program, choosing "create a User-defined gateway". The 
  69. gateway definition screen is essentially a form - you merely 
  70. have to fill in the appropriate details for your gateway.
  71.  
  72.  
  73. Command substitution
  74. --------------------
  75.  
  76. Most of the entries in this screen which accept strings allow 
  77. you to use special command substitution characters in the strings: 
  78. these are like "escape sequences" which will cause PMail to perform 
  79. some substitution at run-time. Command substitutions always begin 
  80. with a tilde (~) character, and are always two characters long. 
  81. The following command substitutions are recognised:
  82.  
  83.    This sequence...   Is replaced with this value
  84.  
  85.    ~c       The full path to the file containing the message
  86.    ~t       The address to which to send this message
  87.             (note: this is not necessarily the To: field)
  88.    ~s       The message's subject field
  89.    ~f       The full form of the message's "from" field
  90.    ~n       The sender's user name in its simplest form
  91.    ~b       The sender's bindery id, as a long hex integer
  92.    ~8       The first 8 chars in the sender's username
  93.    ~y       The time and date in RFC-822 format
  94.    ~d       A random integer, expressed as 4 hex digits
  95.    ~q       Y if this message is a BCC, N otherwise
  96.    ~%name%  The value of the environment variable %name%.
  97.    ~p       The user's personal name preference
  98.    ~x       The name.ext ONLY of the container file (no path)
  99.    ~a       The directory from which PMail was run (or base directory)
  100.    ~h       The current user's home mailbox location
  101.    ~w       The current user's new mail location
  102.    ~~       A single tilde character.
  103.  
  104. Example: Assume that you have defined the gateway output command
  105.  
  106.    mygate ~c ~8 sys:mail/~b
  107.  
  108. And a user called DAVID, whose bindery ID is 4000001 sends a 
  109. message which PMail stores in c:\temp\119944.tmp. When PMail 
  110. invokes your gateway, the command line will be as follows:
  111.  
  112.       mygate c:\temp\119944.tmp DAVID sys:mail/4000001
  113.  
  114. In the following description of the Gateway Definition screen, 
  115. fields marked with an * will support command substitution. Command 
  116. substitution is also possible in the "Home mailbox" and "New 
  117. mailbox" fields of PMail's standalone configuration screen.
  118.  
  119.  
  120. Gateway definition fields
  121. -------------------------
  122.  
  123. Gateway name:  This is the name by which users will know this 
  124. gateway. It should follow legal NetWare naming rules, and cannot 
  125. contain spaces.
  126.  
  127. Users will access the gateway using NetWare usercode syntax so, 
  128. say you call your gateway HONG_KONG, and a user wants to mail 
  129. to someone called J_JONES at the gateway, they would enter the 
  130. address as HONG_KONG/J_JONES.
  131.  
  132. *New mail path:  This is either a full path to a location where 
  133. PMail is to find new mail, or else the name of a program to run 
  134. when checking for new mail. You can use command substitution 
  135. in this string to construct complex paths.  note that PMail will 
  136. assume that ALL mail matching the search mask is for the current 
  137. user - it will not parse messages to determine the recipient. 
  138. If your transport places new mail in the mail directory each 
  139. user has in SYS:MAIL, using a .CNM file extension, then you do 
  140. not need to enter anything in this field. Note that if you have 
  141. a gateway which writes messages into the user's NetWare directory 
  142. in SYS:MAIL using an extension other than .CNM, you can enter 
  143. a search path here using this command substitution: SYS:MAIL/~b 
  144. (See the section on command substitutions for more on this).
  145.  
  146. Is ^ a program to run?  Enter 'Y' if "New mail path" is a program 
  147.  name rather than a directory name. Gateways which require a 
  148. program  to be run to retrieve new mail will not be polled periodically 
  149. - rather, the "check for New mail" option will remain permanently 
  150. on the main menu, and the program can only be run when that option 
  151. is selected.
  152.  
  153. *New mail search mask:  This is a DOS filename pattern which 
  154. PMail is to use when searching the New mail path for new mail. 
  155. New mail messages will be rewritten in the user's home mailbox 
  156. using the normal PMail naming convention prior to reading, but 
  157. they need not be in this format as written by the gateway.
  158.  
  159. *Outgoing mail path:  The name of the directory in which PMail 
  160. should create outgoing mail messages. Again, command substitution 
  161. (described above) can be used in this string for specialised 
  162. processing.
  163.  
  164. *Run for outgoing mail:  If you enter a program name in this 
  165. field,  PMail will run it every time it sends new mail to the 
  166. gateway. The program must leave  the screen in the condition 
  167. it found it (ie, if it writes to the screen, it must do so using 
  168. non-destructive windows). This field is the one which will normally 
  169. benefit the most from the use of command substitution (see above). 
  170. By embedding escape keys in this string, you can construct extremely 
  171. complex command lines. Usually, this field will refer to a "glue" 
  172. program you have written to interface with the gateway: the actual 
  173. invocation of the gateway is intended to be user-activated via 
  174. choices in the SENDER.PM file.
  175.  
  176. *Filename format:  This field allows you some control over the 
  177. filenames PMail will use when creating outgoing messages. The 
  178. ~d command substitution (random integer value) is often very 
  179. useful in this field.
  180.  
  181. Run to validate address:  You can provide a program which PMail 
  182. will call to validate that an address is correct. If you do so, 
  183. enter it in this field. Unlike other command strings, command 
  184. substitution is not possible with this field  the only parameter 
  185. passed on the  command line is the address to validate. Your 
  186. program must not disturb the screen, and must return 0 if the 
  187. address is invalid, or non-zero if the address is OK.  If nothing 
  188. is entered in this field, no attempt will be made to validate 
  189. addresses.
  190.  
  191. *Reply address format:  This field allows you control how PMail 
  192. will construct the "From" address in outgoing messages. You can 
  193. use command substitution in this field.  
  194.  
  195.    Example: entering ~8@home.otago.ac.nz (~p)
  196.    will cause the from field of messages from user david to read 
  197.    david@home.otago.ac.nz (David Harris).
  198.  
  199. Accepts SMTP addresses:  If your gateway accepts messages using 
  200. standard internet address formats, set this flag to 'Y'. If Charon 
  201. is not installed on your system and a user enters a standard 
  202. internet address, PMail will examine all available gateways, 
  203. and will pass the message to the first with this flag set. This 
  204. allows users to send internet mail using normal addressing, rather 
  205. than having to send it specifically via a gateway using the SERVER/ADDRESS 
  206. format.
  207.  
  208. Simple message headers:  PMail can write messages with extra 
  209. preparsed address information at the beginning of the message in
  210. either of two formats:
  211.  
  212. 1: Simple message headers is the original form provided by PMail.
  213.    It is not particularly effective and is only provided for
  214.    backwards compatibility.
  215.  
  216.    The simple header information is line-based, using line number
  217.    as a key. Gateways which read simple message headers must read
  218.    until a totally blank line is encountered, then send the remainder
  219.    of the message, which will be normally formatted. At present, two
  220.    lines are defined in the simple headers, although others may
  221.    be added in future:
  222.  
  223.     * Line 1: The recipient of this message (not the same as
  224.       the To: field)
  225.     * Line 2: Contains 'Y' if this message has attachments.
  226.  
  227.    Lines without values will contain a single space. Addresses are 
  228.    already parsed. Since the format is intended to be extensible, 
  229.    gateways which understand simple headers must ignore lines they 
  230.    are not written to use, and must read until the blank line.
  231.  
  232. 2: 'Glue' headers are an extension of simple headers; they are
  233.    essentially a variant of the format PMail uses for Charon and
  234.    Mercury with a little more information. The first line of the
  235.    message is the signature "$$ " followed by the "from" address
  236.    of the sender. Each subsequent line lists all the addressees
  237.    to which this message should be sent, with a single character
  238.    code at the start of the line indicating whether the address
  239.    is for someone in the "to" field (T), the CC field (C) or the
  240.    BCC field (B). The code is followed by exactly one space then
  241.    the address. The glue headers end with a blank line and are
  242.    followed by the message in canonical RFC822 format. Gateways
  243.    designed to work with glue headers MUST IGNORE a line which
  244.    starts with an unrecognized code character: this allows the
  245.    format to grow. The PMPOP POP3 gateway for PMail v3.0 expects
  246.    to see messages in glue header format.
  247.  
  248. UUencode attachments:  If 'Y', then PMail will generate a separate 
  249. message for each attachment, and will uuencode the attachment 
  250. into the message. If 'N', a file with the same name as the message 
  251. but the extension '.ATT' will be written into the outgoing mail 
  252. directory, along with the attachments. The .ATT file will contain 
  253. the names of the attachments to the message, one per line.
  254.  
  255.    (PMail currently ONLY supports uuencoded attachments).
  256.  
  257. Burst messages?  If 'Y', then PMail will create one message for 
  258. every address sent to: it is up to your gateway process to use 
  259. the ~t command substitution to ensure that delivery is correct, 
  260. since you generally will not be able to tell from the message's 
  261. headers who a particular copy should be sent to. If 'N', PMail 
  262. assumes that your gateway can parse the message for address data, 
  263. and will write all the addresses into one message, using standard 
  264. RFC-822 folding and header rules. The exception to this is messages 
  265. with a BCC header: this will generate two envelopes, one with 
  266. the BCC field, the other without. Your process can determine 
  267. which is the BCC delivery using the ~q command substitution.
  268.  
  269. Force all mail through:  If you set this field to 'Y', then PMail
  270. will pass all mail irrespective of addressing to the gateway for
  271. processing. This effectively disables PMail's support for all other
  272. transports in the system.
  273.  
  274.  
  275. Gateways and BCC:
  276. ----------------
  277.  
  278. Messages with BCC (Blind Carbon Copy) recipients present special 
  279. problems to gateways, since the same message ends up being processed 
  280. twice - once with no BCC header, then again as a separate job 
  281. containing the BCC header. PMail can indicate to the gateway 
  282. process that a message needs BCC processing (using the ~q command 
  283. substitution), but it is up to the gateway process to ensure 
  284. that the BCC field is properly handled, and that the message 
  285. is correctly forwarded. If your gateway does not handle BCC as 
  286. a special case, we recommend that you do NOT use BCC fields.
  287.  
  288.  
  289. Altering the Main menu - PMail 3.0 and later
  290. --------------------------------------------
  291.  
  292. Under PMail 3.0 and later, options are added to the "Send Message"
  293. and "Check New mail" menu items via a resource file called
  294. PM-MENU.RSC. A heavily-commented sample for this file is provided
  295. with the PMail 3.0 distribution - please examine it for further
  296. details.
  297.  
  298.  
  299. Altering the Main menu - PMail 2.35 and earlier
  300. -----------------------------------------------
  301.  
  302. Pegasus Mail v2.35 and earlier allow you to add sub-choices to 
  303. two of the options on the main menu- "Check for New mail" and 
  304. "Send a mail message". The addition is done via a text file called 
  305. SENDER.PM, which must be stored in the same directory as PMAIL.EXE. 
  306. This file contains sets of 5 lines, each set defining one sub-choice. 
  307. Blank lines and lines beginning with a semi-colon (';') are treated 
  308. as comments and are ignored. The lines within each set have the 
  309. following meanings:
  310.  
  311. *    Line 1: Either N if this entry is to be added to the New Mail 
  312. submenu, or S if it is for the Send message submenu.
  313.  
  314. *    Line 2: The text to show in the submenu
  315.  
  316. *    Line 3: Pegasus Mail will create a temporary filename which 
  317. can be passed to the command you specify on the command line. 
  318. If this field is Y, then PMail will look for the file when the 
  319. command returns: if the file exists and is longer than 0 bytes, 
  320. PMail will parse it as a message and mail it normally. This allows 
  321. you to create alternative message entry screens. Note that if 
  322. you use this option, the file must contain a properly-formatted 
  323. RFC-822 message on return. Attachments cannot currently be specified 
  324. in this file.
  325.  
  326. *    Line 4: Enter Y on this line if PMail should save its screen 
  327. before invoking the command, and restore it when the command 
  328. returns. If N, then PMail assumes that the command either does 
  329. no screen output, or that it does it non-destructively.
  330.  
  331. *    Line 5: Enter the command PMail should invoke on this line. 
  332. All command substitutions (see above) are possible here. The 
  333. maximum length of an entry on this line is 80 characters, although 
  334. the command line may be up to 128 characters in length after 
  335. command substitution. To invoke the usual built-in function (ie, 
  336. either Check for New Mail or Send a Message), enter a single 
  337. colon (':') on this line. The command you enter here may be an 
  338. MS-DOS batch file or an executable image.
  339.  
  340.  
  341. A Sample Implementation - PMail and Waffle.
  342. -------------------------------------------
  343.  
  344. Waffle is a particularly good Bulletin-Board System which is 
  345. widely distributed as Shareware on the Internet and on numerous 
  346. public services. Among its features is a solid implementation 
  347. of uucico, the UNIX copy-in - copy-out routine used to make uucp 
  348. transfers. Remember that Waffle is a Shareware program: we urge 
  349. you to send in the shareware license for Waffle if you use any 
  350. part of it - the program is well worth it, and the author deserves 
  351. support.
  352.  
  353. PMail can be quite easily interfaced with Waffle, providing a 
  354. quite functional standalone mail facility via uucp. One small 
  355. "glue" program is required - the source for this is included 
  356. on the PMail distribution diskette as an example of how gateways 
  357. can be implemented. The glue program was written by Brendan Murray, 
  358. Systems Manager at the University of Otago. Brendan has kindly 
  359. made the source freely available and modifiable without charge 
  360. or restriction. Both the glue code and this example assume that 
  361. you have a properly-configured copy of Waffle on your system.
  362.  
  363. Essentially, PMail creates a temporary file, then passes it to 
  364. the glue program, using a number of command substitutions to 
  365. minimise the parsing the program has to do. The glue code then 
  366. parses Waffle's static configuration file and creates appropriate 
  367. mail files in the right place for uucico and uuxqt. Two options 
  368. are added to the main menu to allow the user to choose when to 
  369. invoke uucico to process outgoing mail, and receive incoming 
  370. mail.
  371.  
  372. A sample user-defined gateway definition for Waffle is as follows:
  373.  
  374. Gateway name:              WAFFLE
  375. New mail path:             c:\mailbox\~8
  376. Is ^ a program to run?:    N
  377. New mail search mask:      ~8.*
  378. Outgoing mail path:        c:\scratch\tmp
  379. Run for outgoing mail:     c:\bin\filter ~n ~c ~t ~y
  380. Filename format:           ~d~d.WOM
  381. Run to validate address:    
  382. Reply address format:      ~8@myhost.domain
  383. Accepts SMTP addresses?:   Y
  384. Simple message headers?:   N
  385. UUencode attachments?:     Y
  386. Burst messages?:           Y
  387. Strip GW name?:            Y
  388. Check new mail every x seconds.
  389.  
  390.  
  391. Brendan's filter program locates Waffle's configuration file 
  392. using the WAFFLE environment variable; it expects parameters 
  393. on the command-line in the following order:
  394.  
  395.    1:    The name of the user sending the message
  396.    2:    The name of the message container file
  397.    3:    The To: field of the message
  398.    4:    The time and date as an RFC-822 string
  399.  
  400.  
  401.  
  402. The SENDER.PM file for PMail using Waffle is as follows:
  403.  
  404. S
  405. Regular mail message
  406. N
  407. N
  408. :
  409.  
  410. S
  411. Send all outgoing mail
  412. N
  413. Y
  414. uucico
  415.  
  416. N
  417. Read new mail messages
  418. N
  419. N
  420. :
  421.  
  422. N
  423. Check host for new mail
  424. N
  425. Y
  426. uucico
  427.  
  428.